#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int i = 0;
	scanf("%d",&i);
	int arr1[i];
	int arr2[i];
	int arr3[i];
	int j = 0;
	for (j = 1;j <= i;j++)
	{
		scanf("%d",&arr1[j-1]);
	}
	for (j = 1;j <= i;j++)
	{
		scanf("%d",&arr2[j-1]);
	}
	for (j = 1;j <= i;j++)
	{
		arr3[j - 1] = arr2[j - 1];
		arr2[j - 1] = arr1[j - 1];
		arr1[j - 1] = arr3[j - 1];
	}
	for (j = 1;j <= i;j++)
	{
		printf("%d ",arr1[j-1]);
	}
	printf("\n");
	for (j = 1;j <= i;j++)
	{
		printf("%d ",arr2[j - 1]);
	}
	return 0;
}

